package com.ny.service.impl;
import com.ny.entity.Reservations;
import com.ny.mapper.UserMapper;
import com.ny.entity.Users;
import com.ny.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public Users login(String username, String password) {
        return userMapper.findUserByUsernameAndPassword(username, password);
    }

    @Override
    public void updateUsersPassword(int userId, String password) {
        userMapper.updateUsersPassword(userId, password);
    }

    @Override
    public void updatePhoneNumber(int userId, String phoneNumber) {
        userMapper.updatePhoneNumber(userId, phoneNumber);

    }

    @Override
    public List<Reservations> findReservationsByUserId(int userId) {
        return userMapper.findReservationsByUserId(userId);
    }
    @Override
    public List<Reservations> findReservations(String username, String classroomName, Date startDatetime, Date endDatetime, String status) {
        return userMapper.findReservations(username, classroomName, startDatetime, endDatetime, status);
    }
}
